<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.prime.com.tr/ui"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:cc="http://java.sun.com/jsf/composite">
	
	
	
	    <cc:interface>
	    	<cc:attribute name="renderedSalvar" required="true"/>
	    	<cc:attribute name="renderedAlterar" required="true"/>
	    	<cc:attribute name="renderedLimpar" required="true"/>
	    	<cc:attribute name="renderedFechar" required="true"/>
	    	<cc:attribute name="update" required="true"/>
        </cc:interface>
	
	
	<cc:implementation>
	
	    <br />
    	<h:panelGrid columns="2">
    	
 	    	<h:column>
 	    		<div style="width:60px; text-align: left">
 	    			<h:outputText for="nome" value="Nome: "/>
 	    			<span style="color: red">*</span>
 	    	    </div>
 	    	</h:column>
 	    	
			<h:column>	
		    	<p:inputText  
		    		style="width:150px;"
				    id="nome"
					value="#{unidadeMBean.unidade.nome}"
					required="true"
					requiredMessage="O campo 'Nome' é obrigatório!"
					maxlength="33"
				/>
			</h:column>
			
    		<h:column>
    			<div style="width:60px; text-align: left">
    				<h:outputText for="tipo"   value="Tipo: "  />
    				<span style="color: red">*</span>
    			</div>
    		</h:column>
    		
		    <h:column>
		    
		    	<h:selectOneListbox 
		    		required="true"
		    		requiredMessage="Campo 'Tipo' de preenchimento obrigatório"
		    		size="1"
		    		value="#{unidadeMBean.unidade.tipo}"
		    		id="tipo"
		    		style="width:160px;"
		    	
		    	>
		    	    <f:selectItem id="nenhum" itemLabel="Selecione..." itemValue="" />
					<f:selectItem id="matriz" itemLabel="MATRIZ" itemValue="MATRIZ" />
					<f:selectItem id="filial" itemLabel="FILIAL" itemValue="FILIAL" />
					<f:selectItem id="PrestadoraServico" itemLabel="PRESTADORA DE SERVIÇO" itemValue="PRESTADORA DE SERVICO" />
				</h:selectOneListbox>
			</h:column>
	
	
	
	    	<h:column>
    			<div style="width:60px; text-align: left">
    				<h:outputText for="status"   value="Status: "  />
    				<span style="color: red">*</span>
    			</div>
    		</h:column>		
			<h:column>
	            <h:selectOneListbox 
		    		required="true"
		    		requiredMessage="Campo 'Status' de preenchimento obrigatório"
		    		size="1"
		    		value="#{unidadeMBean.unidade.status}"
		    		id="status"
		    		style="width:160px;"
		    	
		    	>	
                    <f:selectItem id="vazio" itemLabel="Selecione..." itemValue="" />
					<f:selectItem id="habilitado" itemLabel="Habilitado" itemValue="Habilitado" />
					<f:selectItem id="Inativo" itemLabel="Inativo" itemValue="Inativo" />
		    	</h:selectOneListbox>	
			</h:column>
				        
      </h:panelGrid>

	  <p:separator style="width:230px; height:1px;" />
	  
	  <div style="text-align: right">
	  	
		<p:commandButton
			value="Salvar"
			type="push" 
			action="#{unidadeMBean.salvar}"
			update="#{update}"
			rendered="#{renderedSalvar}"
			image="ui-icon-disk"
		/>
		
		<p:commandButton
			value="Alterar"
			type="push" 
			action="#{unidadeMBean.alterar}"
			update="#{update}"
			rendered="#{renderedAlterar}"
			image="ui-icon-disk"
		/>				   
		
		<p:commandButton
			value="Limpar"
			type="reset" 
			image="ui-icon-disk"
			rendered="#{renderedLimpar}"
		/>
		
		<p:commandButton
			value="Fechar"
			type="push" 
			oncomplete="alteracao.hide()"
			image="ui-icon-disk"
			rendered="#{renderedFechar}"
		/>					   				   
	</div>
	<br />

</cc:implementation>
</html>